25. HSV Conversion

Nd113 C7 23 L HSV Conversion

HSV Conversion

In the code example, I used HSV space to help detect a green screen background under different lighting conditions. OpenCV provides a function hsv = cv2.cvtColor(im, cv2.COLOR_RGB2HSV) that converts images from one color space to another.

After this conversion, I plotted the individual color channels; it was easy to see that the Hue channel remained fairly constant under different lighting conditions.

H, S, and V channels for the green screen car image.

H, S, and V channels for the green screen car image.

Next, I used the same masking code as before only using a Hue channel color mask, next you'll see how this looks in a notebook!